﻿<!DOCTYPE html>
<html ng-app="demoApp">
<head>
    <title id='Description'>The AngularJS DropDownList comes with several useful events. When the user selects an item, the 'select' and 'unselect' events are triggered.    
    </title>
    <meta name="description" content="AngularJS DropDownList example. This example demonstrates a DropDownList binding to Events." /> 
    <link rel="stylesheet" href="../../../jqwidgets/styles/jqx.base.css" type="text/css" />
    <script type="text/javascript" src="../../../scripts/angular.min.js"></script>
    <script type="text/javascript" src="../../../scripts/jquery-1.11.1.min.js"></script>
    <script type="text/javascript" src="../../../jqwidgets/jqxcore.js"></script>
    <script type="text/javascript" src="../../../scripts/demos.js"></script>
    <script type="text/javascript" src="../../../jqwidgets/jqxbuttons.js"></script>
    <script type="text/javascript" src="../../../jqwidgets/jqxdata.js"></script>
    <script type="text/javascript" src="../../../jqwidgets/jqxscrollbar.js"></script>
    <script type="text/javascript" src="../../../jqwidgets/jqxlistbox.js"></script>
    <script type="text/javascript" src="../../../jqwidgets/jqxdropdownlist.js"></script>
    <script type="text/javascript" src="../../../jqwidgets/jqxangular.js"></script>
    <script type="text/javascript">
        var demoApp = angular.module("demoApp", ["jqwidgets"]);
        demoApp.controller("demoController", function ($scope) {
            var source = [
              "Affogato",
              "Americano",
              "Bicerin",
              "Breve",
              "Café Bombón",
              "Café au lait",
              "Caffé Corretto",
              "Café Crema",
              "Caffé Latte",
              "Caffé macchiato",
              "Café mélange",
              "Coffee milk",
              "Cafe mocha",
              "Cappuccino",
              "Carajillo",
              "Cortado",
              "Cuban espresso",
              "Espresso",
              "Eiskaffee",
              "The Flat White",
              "Frappuccino",
              "Galao",
              "Greek frappé coffee",
              "Iced Coffee﻿",
              "Indian filter coffee",
              "Instant coffee",
              "Irish coffee",
              "Liqueur coffee"
            ];
            // listbox settings.
            $scope.settings = { source: source, width: 200, height: 25 };

            $scope.onSelect = function (event) {
                var args = event.args;
                if (args) {
                    $scope.selectLog = 'Selected: ' + args.item.label;
                }
            };

            $scope.onUnselect = function (event) {
                var args = event.args;
                if (args && args.item) {
                    $scope.unselectLog = 'Unselected: ' + args.item.label;
                }
            };
        });
    </script>
</head>
<body ng-controller="demoController">
    <jqx-drop-down-list jqx-instance="listBox" jqx-on-select="onSelect(event)" jqx-on-unselect="onUnselect(event)" jqx-settings="settings"></jqx-drop-down-list>
    <br />
    <div style="font-family: 'segoe ui', arial, sans-serif;">
        select event log: {{selectLog}}
    <br />
        unselect event log: {{unselectLog}}
    </div>
</body>
</html>
